#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2020/4/27 15:24
# @Author : 侯建军
# @Site : huoniu8.com
# @File : Employee.py
# @Software: PyCharm

class Employee:
    # 员工数量,静态字段
    empCount = 0

    def __init__(self, name, salary):
        # 实例字段
        self.name = name
        self.salary = salary
        Employee.empCount += 1

    # @staticmethod 静态方法
    @staticmethod
    def displayEmpCount():
        print("总共员工数：", Employee.empCount)

    def displayEmployee(self):
        print("name: {0} salary: {1}".format( self.name, self.salary))

    # @classmethod类方法
    @classmethod
    def classMethodTest(self):
        print("类方法")

if __name__ == '__main__':
    # 创建对象
    emp = Employee("张三", 5000)
    # 实例方法调用
    emp.displayEmployee()
    # 静态方法调用
    Employee.displayEmpCount()
    emp.displayEmpCount()
    # 类方法调用
    Employee.classMethodTest()
    emp.classMethodTest()
